<template>
  <div>
    <div>变量1:{{ num1 }} <button @click="num1++">更新num1</button></div>
    <div>变量2:{{ num2 }} <button @click="num2++">更新num2</button></div>
  </div>
</template>

<script lang='ts' setup>
import {ref,watch} from 'vue'
//1、定义两个ref变量
let num1=ref<number>(10)
let num2=ref<number>(30)
//2、侦听多个ref变量
watch([num1,num2],(newval,oldval)=>{
    console.log(newval,oldval)
})
</script>

<style lang='scss' scoped>
</style>